<template>
  <div>
    <span>普通工人</span>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="满足率">
        <el-input v-model="formInline.satisfy" placeholder="满足率"></el-input>
      </el-form-item>
      <el-form-item label="变动原因">
        <el-input v-model="formInline.changereason" placeholder="变动原因"></el-input>
      </el-form-item>
      <el-form-item >
        <el-select v-model="formInline.comparison" placeholder="数据变化">
          <!-- <el-option key='0' label="不限" value="不限"></el-option> -->
          <el-option
              v-for="item in teji"
              :key="item.id"
              :label="item.shift"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="formInline.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>

    <span>技术人才</span>
    <el-form :inline="true" :model="technology" class="demo-form-inline">
      <el-form-item label="满足率">
        <el-input v-model="technology.satisfy" placeholder="满足率"></el-input>
      </el-form-item>
      <el-form-item label="变动原因">
        <el-input v-model="technology.changereason" placeholder="变动原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select v-model="technology.comparison" placeholder="上升/下降/不变">
          <el-option
              v-for="item in teji"
              :key="item.id"
              :label="item.shift"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="technology.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>

    <span>高端人才</span>
    <el-form :inline="true" :model="upscale" class="demo-form-inline">
      <el-form-item label="满足率">
        <el-input v-model="upscale.satisfy" placeholder="满足率"></el-input>
      </el-form-item>
      <el-form-item label="变动原因">
        <el-input v-model="upscale.changereason" placeholder="变动原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select v-model="upscale.comparison" placeholder="上升/下降/不变">
          <el-option
              v-for="item in teji"
              :key="item.id"
              :label="item.shift"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="upscale.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>

    <span>急需人才</span>
    <el-form :inline="true" :model="needs" class="demo-form-inline">
      <el-form-item label="人员缺口类型">
        <el-select v-model="needs.need" placeholder="人员缺口类型">
          <el-option
              v-for="item in renyuankouque"
              :key="item.id"
              :label="item.talenttype"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="急需人才数量">
        <el-input v-model="needs.quantity" placeholder="急需人才数量"></el-input>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="needs.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>
    <el-form>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">确定修改</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formInline: {
        satisfy: '',
        changereason: '',
        creatdate: "",
        employeetype: '1',
        state:'1',
        comparison:'',
      },
      technology:{
        percentage: '',
        changereason: '',
        creatdate: "",
        employeetype: 2,
        state:1,
        comparison:'',
      },
      upscale:{
        percentage: '',
        changereason: '',
        creatdate: "",
        employeetype: 3,
        state:1,
        comparison:'',
      },
      needs:{
        need:"",
        quantity: "",
        creatdate:"",
        employeetype: 4,
        state:1,
        comparison:null,
      },
      teji:[],
      renyuankouque:[],
    }
  },
  methods: {
    onSubmit() {
      const _this = this
      console.log(_this.formInline)
      axios.put('http://localhost:8081/talent/putong/update',_this.formInline).then(function (resp){
        console.log(_this.formInline)
      })
      axios.put('http://localhost:8081/talent/putong/update',_this.technology).then(function (resp){

      })
      axios.put('http://localhost:8081/talent/putong/update',_this.upscale).then(function (resp){

      })
      axios.put('http://localhost:8081/talent/jixu/update',_this.needs).then(function (resp){
      })
    }
  },
  created() {
    const _this = this
    axios.get('http://localhost:8081/talent/putong/1').then(function (resp){
      console.log(_this.formInline)
      _this.formInline = resp.data
    })
    axios.get('http://localhost:8081/talent/putong/2').then(function (resp){
      _this.technology = resp.data
    })
    axios.get('http://localhost:8081/talent/putong/3').then(function (resp){
      _this.upscale = resp.data
    })
    axios.get('http://localhost:8081/talent/jixu/4').then(function (resp){
      _this.needs = resp.data
    })
    axios.get('http://localhost:8081/talent/variation').then(function (resp){
      _this.teji = resp.data
    })
    axios.get('http://localhost:8081/talent/talentselect').then(function (resp){
      _this.renyuankouque = resp.data
    })
  }
}
</script>

<style scoped>
.span1{
  position: absolute;
  margin-top: 80px;
  margin-left: -800px;
}
</style>